/*
 * TagDouble.cpp
 *
 *  Created on: 19 juin 2011
 *      Author: Pierrick Caillon <pierrick@megami.fr>
 */

#include "TagDouble.h"

/* NAMEDTAG_H_ */
/* NUMERICVALUE_H_ */
namespace NamedBinaryTag
{
    TagDouble::TagDouble()
    :NamedTag(), value(*(double*)(("\x00\x00\x00\x00\x00\x00\xF0\xFF")))
    {
    }

    TagDouble::~TagDouble()
    {
    }

    void TagDouble::Read(std::istream & input, bool ignoreName)
    {
        NamedTag::Read(input, ignoreName);
        ReadData(input, (char*)((&this->value)));
    }

    void TagDouble::set_Value(double value)
    {
        this->value = value;
    }

    TagTypes TagDouble::get_TagType() const
    {
        return TAG_DOUBLE;
    }

    void TagDouble::Write(std::ostream & output, bool ignoreName) const
    {
        NamedTag::Write(output, ignoreName);
        WriteData(output, (const char*)((&this->value)));
    }

    double TagDouble::get_Value() const
    {
        return value;
    }

    ITag *TagDouble::clone() const
    {
    	return this->clone(NULL);
    }

    ITag *TagDouble::clone(void *newRoot) const
    {
        TagDouble *copy = new TagDouble(newRoot);
        copy->value = this->value;
        return copy;
    }

}
